#include "EGameTime.h"
#include "eCPP.h"

namespace engine
{
const float EGameTime::s_fDefaultFPS          = 1.f / 60.f;
const float EGameTime::s_fDTClampTreshold     = 1.f / 20.f;
//------------------------------------------------------------
EGameTime::EGameTime() :
m_fGameTimeMultiplier( 1.f ),
m_fUserTimeMultiplier( 1.f ),
m_fGlobalTimeMultiplier( 1.f ),
m_fDT( 0.f ),
m_fRealDT( 0.f ),
m_fDT60( 0.f ),
m_fRealDT60( 0.f )
{

}

//------------------------------------------------------------
void EGameTime::setTimeSinceLastFrame( float fTimeSinceLastFrame )
{
  m_fRealDT   = fTimeSinceLastFrame;
  if( m_fRealDT > s_fDTClampTreshold )
    m_fRealDT = s_fDTClampTreshold;
  m_fDT       = m_fRealDT * m_fGlobalTimeMultiplier;
  m_fDT60     = m_fDT * 60.f;
  m_fRealDT60 = m_fRealDT * 60.f;
}

//------------------------------------------------------------
void EGameTime::setUserTimeMultiplier( float fTimeMultiplier )
{
  m_fUserTimeMultiplier   = fTimeMultiplier;
  m_fGlobalTimeMultiplier = m_fUserTimeMultiplier * m_fGameTimeMultiplier;
}

//------------------------------------------------------------
void EGameTime::setGameTimeMultiplier( float fTimeMultiplier )
{
  m_fGameTimeMultiplier   = fTimeMultiplier;
  m_fGlobalTimeMultiplier = m_fUserTimeMultiplier * m_fGameTimeMultiplier;
}

} // end namespace